use safe arithmetic wherever gas calculations can cause U256 to overflow#344
Merged
SamWilsn merged 1 commit intoethereum:masterfrom Sep 16, 2021
Merged
use safe arithmetic wherever gas calculations can cause U256 to overflow#344SamWilsn merged 1 commit intoethereum:masterfrom
SamWilsn merged 1 commit intoethereum:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #344 +/- ##
==========================================
+ Coverage 95.04% 95.10% +0.06%
==========================================
Files 46 46
Lines 2322 2351 +29
==========================================
+ Hits 2207 2236 +29
Misses 115 115
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
SamWilsn
approved these changes
Sep 16, 2021
Carsons-Eels
pushed a commit
to Carsons-Eels/execution-specs
that referenced
this pull request
Oct 16, 2025
* chore: fix deprecated vs code settings ethereum#344
danceratopz
added a commit
to danceratopz/execution-specs
that referenced
this pull request
Oct 22, 2025
* chore: fix deprecated vs code settings ethereum#344
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong?
Related to Issue #342
#342 introduced safe arithmetic for handling gas calculations that could overflow U256. There are several more places where gas calculations can cause U256 to overflow.
How was it fixed?
Used safe arithmetic wherever gas calculations can cause U256 to overflow.
Note:
The Yellow paper says that the "data" size is unlimited:

There are some precompiles that calculate gas cost based on the input data size. This is the reason why
u256_safe_addandu256_safe_multiplyhave been modified to acceptUintas input.Cute Animal Picture
Pic credits: pexels.com